package uns.fit.gis.contextmenu;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;

public abstract class ContextMenu implements CommandListener{
	protected Command[] commands;
	
	public void attach(Displayable displayable) {
		for(int i = 0; i < commands.length; i ++) {
			displayable.addCommand(commands[i]);
		}
		displayable.setCommandListener(this);
	}
	
	public void detach(Displayable displayable) {
		for(int i = 0; i < commands.length; i ++) {
			displayable.removeCommand(commands[i]);
		}
	}
}
